package club.hicode.daydayup.abc.condition;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

/**
 *
 * @author Liu Chunfu
 * @date 2018-08-23 下午8:50
 **/
public class ConSpeaker extends Thread {

	private Condition nextCondition;

	private ReentrantLock curLock;
	private String key;

	public ConSpeaker(Condition nextCondition, ReentrantLock curLock, String key) {
		this.nextCondition = nextCondition;
		this.curLock = curLock;
		this.key = key;
	}

	@Override
	public void run() {
		curLock.lock();
		System.out.println(key);
		nextCondition.signal();
	}
}
